{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.【填空】如下代码的运行结果为：（ ）。\n",
    "```\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "df=pd.DataFrame(np.arange(1,21).reshape(5,4))\n",
    "df.tail(2)```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案： \n",
    "\n",
    "|   | 0  | 1 | 2 | 3 |  \n",
    "|:---|--- |---|---|---|\n",
    "| 3 | 13 | 14 | 15 | 16 |  \n",
    "| 4 | 17 | 18 | 19 | 20 |  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2.【填空】如下代码的运行结果为：（ ）。\n",
    "```\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "df=pd.DataFrame(np.arange(1,21).reshape(5,4))\n",
    "df.iloc[3,2]```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：15。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "3.【填空】如下代码的运行结果为：（ ）。\n",
    "```\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "df=pd.DataFrame(np.arange(1,21).reshape(5,4))\n",
    "df.reindex(index=[1,2],columns=[3,4],fill_value=666)```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案： \n",
    "\n",
    "|   | 3  |  4  |  \n",
    "|:---|:---: |:---:|  \n",
    "| 1 | 8 | 666 |  \n",
    "| 2 | 12 | 666 |     "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "4.【填空】如下代码的运行结果为：（ ）。\n",
    "```\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "df=pd.DataFrame(np.arange(1,21).reshape(5,4))\n",
    "del df[2]\n",
    "df.drop([2,3], axis=0, inplace=True)\n",
    "df```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案： \n",
    "\n",
    "|   | 0  | 1 | 3 |      \n",
    "|:---|--- |---|---|  \n",
    "| 0 | 1 | 2 | 4 |    \n",
    "| 1 | 5 | 6 | 8 |     \n",
    "| 4 | 17 | 18 |  20 |"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "5.【填空】如下代码的运行结果为：（ ）。\n",
    "```\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "df=pd.DataFrame(np.arange(1,17).reshape(4,4))\n",
    "df>(3,6,9,12)```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案： \n",
    "\n",
    "|   | 0  | 1 | 2 | 3 |      \n",
    "|:---|--- |---|---|---|   \n",
    "| 0 | False | False | False | True |      \n",
    "| 1 | False | False | True | True |     \n",
    "| 2 | False | True |  True | True |  \n",
    "| 3 | True | True |  True | True |  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "6.【填空】如下代码的运行结果为：（ ）。\n",
    "```\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "A=pd.DataFrame(np.array([1,2,3,4,5,6]).reshape(2,3),columns=list(\"abc\"),index=list(\"AC\"))\n",
    "B=pd.DataFrame(np.array([7,8,9,10,11,12]).reshape(3,2), columns=list(\"ac\"),index=list(\"ABC\"))\n",
    "C=A+B\n",
    "C.fillna(method=\"bfill\")```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案： \n",
    "\n",
    "|   | a  | b | c |      \n",
    "|:---|--- |---|---|  \n",
    "| A | 8.0 | NaN | 11.0 |    \n",
    "| B | 15.0 | NaN | 18.0 |     \n",
    "| C | 15.0 | NaN |  18.0 |"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "7.【判断】查看DataFrame的列名时用columns属性；查看行名时用rows属性。（ ）  \n",
    "\n",
    "A. √  \n",
    "B. ×"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "答案：B。"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [default]",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
